home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
t_os
/
mtcnv
/
mtcnv45a.bas
next >
Wrap
BASIC Source File
|
1993-11-30
|
10KB
|
222 lines
100 '==================================
110 '
120 ' MSX→TOWNS グラフィック コンバーター Ver 4.5a
130 ' BSAVE形式→TIFF形式
140 ' (FILES版) Programed by YAZ
150 '==================================
1000 CLEAR ,,,70000:SCREEN@ 0:COLOR 7,0,7,0:PALETTE:CONSOLE 0,24,2
1010 DEFINT A-Z:DEFLNG F,M:DIM GRPDAT(255),IMA(27136),C(3,2),PALDAT(47)
1020 M_ADJ=VARPTR(GRPDAT(0))
1030 *INIT '=============================================================
1040 SCREEN@ 0:CLS:PALETTE
1050 FOR I=0 TO 255:GRPDAT(I)=0:NEXT:DR$="":WILD$="":SDR$=""
1060 PRINT "読み込むドライブ ( DRV:A-Q END:@ ) :";:DR$=INPUT$(1):PRINT DR$
1070 IF (DR$<"@" OR "Q"<DR$) AND (DR$<"a" OR "q"<DR$) THEN 1060
1080 IF DR$="@" THEN END
1090 INPUT "ワイルドカード :",WILD$
1100 IF WILD$="" THEN WILD$=DR$+":*.*" ELSE WILD$=DR$+":"+WILD$
1110 ON ERROR GOTO *ERR_TRAP1
1120 FILES WILD$
1130 ON ERROR GOTO 0
1140 INPUT"ファイルネーム : ";NME$
1150 IF NME$="" OR INSTR(NME$," ") THEN 1140
1160 PRINT "スクリーンモード ( 1:SCREEN_5 2:SCREEN_6 3:SCREEN_7 4:SCREEN_8 5:19268色 )":PRINT ": ";
1170 A$=INPUT$(1):PRINT A$
1180 IF A$<"1" OR "5"<A$ THEN 1160
1190 IF A$="1" THEN SCRMODE=1:REP=256/2:S_SIZE=1
1200 IF A$="2" THEN SCRMODE=2
1210 IF A$="3" THEN SCRMODE=3:REP=512/2:S_SIZE=2
1220 IF A$="4" THEN SCRMODE=4
1230 IF A$="5" THEN SCRMODE=5
1240 PRINT "保存するドライブ ( A-P ) :";:SDR$=INPUT$(1):PRINT SDR$
1250 IF (SDR$<"A" OR "P"<SDR$) AND (SDR$<"a" OR "p"<SDR$) THEN 1240
1260 PRINT "全てよろしいですか? ( Y/N ) : ";:A$=INPUT$(1):PRINT A$
1270 IF A$="N" OR A$="n" THEN *INIT ELSE IF A$<>"Y" AND A$<>"y" THEN 1260
1280 *CONV '=============================================================
1290 ON ERROR GOTO *ERR_TRAP1
1300 OPEN "I",#1,DR$+":"+NME$
1310 ON ERROR GOTO 0
1320 F_MOD=ASC(INPUT$(1,#1))
1330 IF F_MOD<>254 THEN PRINT "BSAVE形式ではありません":CLOSE #1:BEEP: WAIT 80:GOTO *INIT
1340 F_STA=ASC(INPUT$(1,#1))+ASC(INPUT$(1,#1))*256
1350 F_BTM=ASC(INPUT$(1,#1))+ASC(INPUT$(1,#1))*256
1360 S$=INPUT$(2,#1)
1370 CLS:ON SCRMODE GOSUB *SCR_5・7,*SCR_6,*SCR_5・7,*SCR_8,*SCR_12
1380 *SAVE '=============================================================
1390 X=0:Y=0:MOUSE 0:MOUSE 1,,,1
1400 MOUSE 4,0,0,639+(SCRMODE=5)*320,479+(SCRMODE=5)*240
1410 LOCATE 66,21
1420 IF P_SCH=0 THEN PRINT "PALETTE OFF"; ELSE PRINT "PALETTE ON ";
1430 IF SCRMODE=2 OR SCRMODE=3 THEN SX=511:SY=423 ELSE SX=255:SY=211
1440 LOCATE 66,16:PRINT "[ESC]=中止"
1450 LOCATE 67,18:PRINT USING"X=### Y=###";X;Y;
1460 LOCATE 66,19:PRINT USING"SX=### SY=###";SX;SY;
1470 LINE (X,Y)-(SX,SY),XOR,7,B
1480 CIRCLE (X,Y),5,7,,,,,XOR:CIRCLE (SX,SY),5,7,,,,,XOR
1490 XX=X:YY=Y:SXX=SX:SYY=SY
1500 A$=INKEY$
1510 IF NOT(A$=CHR$(27) OR A$=CHR$(13) OR A$=" " OR MOUSE(2,0)) THEN 1500
1520 IF MOUSE(2,0)=0 THEN 1670
1530 DX=MOUSE(4,0):DY=MOUSE(5,0)
1540 IF ABS(DX-X)>5 OR ABS(DY-Y)>5 THEN 1600
1550 MOUSE 4,0,0,SX-8,SY-8
1560 WHILE MOUSE(2,0)
1570 X=MOUSE(0):Y=MOUSE(1)
1580 IF X<>XX OR Y<>YY THEN GOSUB *SAVE_SUB
1590 WEND:GOTO 1660
1600 IF ABS(DX-SX)>5 OR ABS(DY-SY)>5 THEN 1670
1610 MOUSE 4,X+8,Y+8,639+(SCRMODE=5)*320,479+(SCRMODE=5)*240
1620 WHILE MOUSE(2,0)
1630 SX=MOUSE(0):SY=MOUSE(1)
1640 IF SX<>SXX OR SY<>SYY THEN GOSUB *SAVE_SUB
1650 WEND
1660 MOUSE 4,0,0,639+(SCRMODE=5)*320,479+(SCRMODE=5)*240
1670 IF A$=CHR$(27) THEN MOUSE 5:GOTO *INIT
1680 IF A$<>" " OR SCRMODE>3 THEN 1740
1690 LOCATE 66,21
1700 IF P_SCH<>0 THEN PRINT "PALETTE OFF";:PALETTE:P_SCH=0:GOTO 1740
1710 FOR J=0 TO 15+(SCRMODE=2)*12
1720 PALETTE J,[PALDAT(J*3),PALDAT(J*3+1),PALDAT(J*3+2)]
1730 NEXT:P_SCH=1:PRINT "PALETTE ON ";
1740 IF A$<>CHR$(13) THEN 1500 ELSE MOUSE 5
1750 CIRCLE (X,Y),5,7,,,,,XOR:CIRCLE (SX,SY),5,7,,,,,XOR
1760 LINE (X,Y)-(SX,SY),XOR,7,B
1770 ON ERROR GOTO *ERR_TRAP2
1780 SAVE@ SDR$+":"+LEFT$(NME$,INSTR(NME$,"."))+"TIF",(X,Y)-(SX,SY),P_SCH
1790 ON ERROR GOTO 0:GOTO *INIT
1800 *SAVE_SUB '=================
1810 MOUSE 1,,,0
1820 CIRCLE (XX,YY),5,7,,,,,XOR:CIRCLE (SXX,SYY),5,7,,,,,XOR
1830 CIRCLE (X,Y),5,7,,,,,XOR:CIRCLE (SX,SY),5,7,,,,,XOR
1840 LINE (XX,YY)-(SXX,SYY),XOR,7,B:LINE (X,Y)-(SX,SY),XOR,7,B
1850 MOUSE 1,,,1:XX=X:YY=Y:SXX=SX:SYY=SY
1860 LOCATE 67,18:PRINT USING"X=### Y=###";X;Y;
1870 LOCATE 66,19:PRINT USING"SX=### SY=###";SX;SY;
1880 RETURN
1890 *SCR_5・7 '==========================================================
1900 LOCATE 66,16:PRINT "[ESC]=中止"
1910 Y=0:ES=0:F_ADJ=F_STA MOD REP:F_ADR=F_STA-F_ADJ
1920 IF F_ADJ<>0 THEN S$=STRING$(F_ADJ-1,0)+INPUT$(REP-F_ADJ,#1) ELSE 2000
1930 FOR J=1 TO REP-1
1940 AS=ASC(MID$(S$,J,1))
1950 POKE M_ADJ+J,AS \16+(AS AND 15)*16
1960 NEXT
1970 POKE M_ADJ,0
1980 PUT@A (0,0)-(REP*2-1,0),GRPDAT,,,S_SIZE
1990 Y=Y+1
2000 WHILE F_ADR<F_BTM AND ES=0
2010 IF INKEY$=CHR$(27) THEN ES=-1:GOTO 2120
2020 IF F_BTM-F_ADR>=REP THEN S$=INPUT$(REP-1,#1):S1$=INPUT$(1,#1) ELSE S$=INPUT$(F_BTM-F_ADR,#1):S$=S$+STRING$(REP-1-LEN(S$),0):S1$=CHR$(0)
2030 FOR J=1 TO REP-1
2040 AS=ASC(MID$(S$,J,1))
2050 POKE M_ADJ+J-1,AS \16+(AS AND 15)*16
2060 NEXT
2070 AS=ASC(S1$)
2080 POKE M_ADJ+REP-1,AS \16+(AS AND 15)*16
2090 PUT@A (0,Y*S_SIZE)-(REP*2-1,Y*S_SIZE),GRPDAT,,,S_SIZE
2100 IF F_ADR=&H7680-33664*(SCRMODE=3) THEN GOSUB *GET_PAL
2110 Y=Y+1:F_ADR=F_STA-F_ADJ+REP*Y
2120 WEND:CLOSE
2130 IF ES=-1 THEN LOCATE 66,16:PRINT "中止します。":WAIT 80:RETURN *INIT
2140 RETURN
2150 *SCR_6 '============================================================
2160 LOCATE 66,16:PRINT "[ESC]=中止"
2170 Y=0:ES=0:F_ADJ=F_STA MOD 128:F_ADR=F_STA-F_ADJ
2180 IF F_ADJ<>0 THEN S$=STRING$(F_ADJ-1,0)+INPUT$(128-F_ADJ,#1) ELSE 2270
2190 FOR J=1 TO 127
2200 AS=ASC(MID$(S$,J,1))
2210 POKE M_ADJ+J*2,AS \64+(AS \16 AND 3)*16
2220 POKE M_ADJ+J*2+1,(AS \4 AND 3)+(AS AND 3)*16
2230 NEXT
2240 POKE M_ADJ,0,2
2250 PUT@A (0,0)-(511,0),GRPDAT,,,2
2260 Y=Y+1
2270 WHILE F_ADR<F_BTM AND ES=0
2280 IF INKEY$=CHR$(27) THEN ES=-1:GOTO 2380
2290 IF F_BTM-F_ADR>=128 THEN S$=INPUT$(128,#1) ELSE S$=INPUT$(F_BTM-F_ADR,#1):S$=S$+STRING$(128-LEN(S$),0)
2300 FOR J=1 TO 128
2310 AS=ASC(MID$(S$,J,1))
2320 POKE M_ADJ+J*2-2,AS \64+(AS \16 AND 3)*16
2330 POKE M_ADJ+J*2-1,(AS \4 AND 3)+(AS AND 3)*16
2340 NEXT
2350 PUT@A (0,Y*2)-(511,Y*2),GRPDAT,,,2
2360 IF F_ADR=&H7680 THEN GOSUB *GET_PAL
2370 Y=Y+1:F_ADR=F_STA-F_ADJ+128*Y
2380 WEND:CLOSE
2390 IF ES=-1 THEN LOCATE 66,16:PRINT "中止します。":WAIT 80:RETURN *INIT
2400 RETURN
2410 *SCR_8 '============================================================
2420 SCREEN@ 2:LOCATE 66,16:PRINT "[ESC]=中止"
2430 Y=0:ES=0:F_ADJ=F_STA MOD 256:F_ADR=F_STA-F_ADJ
2440 IF F_ADJ<>0 THEN S$=STRING$(F_ADJ-1,0)+INPUT$(256-F_ADJ,#1) ELSE 2510
2450 FOR J=1 TO 255
2460 POKE M_ADJ+J,ASC(MID$(S$,J,1))
2470 NEXT
2480 POKE M_ADJ,0
2490 PUT@A (0,0)-(255,0),GRPDAT
2500 Y=Y+1
2510 WHILE F_ADR<F_BTM AND ES=0
2520 IF INKEY$=CHR$(27) THEN ES=-1:GOTO 2600
2530 IF F_BTM-F_ADR>=256 THEN S$=INPUT$(255,#1):S1$=INPUT$(1,#1) ELSE S$=INPUT$(F_BTM-F_ADR,#1):S$=S$+STRING$(255-LEN(S$),0):S1$=CHR$(0)
2540 FOR J=1 TO 255
2550 POKE M_ADJ+J-1,ASC(MID$(S$,J,1))
2560 NEXT
2570 POKE M_ADJ+255,ASC(S1$)
2580 PUT@A (0,Y)-(255,Y),GRPDAT
2590 Y=Y+1:F_ADR=F_STA-F_ADJ+256*Y
2600 WEND:CLOSE
2610 IF ES=-1 THEN LOCATE 66,16:PRINT "中止します。":WAIT 80:RETURN *INIT
2620 P_SCH=0:RETURN
2630 *SCR_12 '===========================================================
2640 GOSUB *SCR_8
2650 GET@A (0,0)-(255,211),IMA
2660 SCREEN@ 1:CLS:LOCATE 66,16:PRINT "[ESC]=中止"
2670 FOR H=0 TO 211
2680 IF INKEY$=CHR$(27) THEN H=211:NEXT:LOCATE 66,16:PRINT "中止します。": WAIT 80:GOTO *INIT
2690 FOR I=0 TO 126 STEP 2
2700 FSUB0=IMA(H*128+I) AND 65535
2710 FSUB1=IMA(H*128+I+1) AND 65535
2720 Y0=(FSUB0 \ 8)AND 31:Y1=(FSUB0 \ 2048)AND 31
2730 Y2=(FSUB1 \ 8)AND 31:Y3=(FSUB1 \ 2048)AND 31
2740 K=((FSUB0 \ 32)AND 56)+(FSUB0 AND 7):K=K+(K>31)*64
2750 J=((FSUB1 \ 32)AND 56)+(FSUB1 AND 7):J=J+(J>31)*64
2760 C(0,0)=Y0+K:C(0,1)=Y0+J:C(0,2)=Y0*5\4-J\2-K\4
2770 C(1,0)=Y1+K:C(1,1)=Y1+J:C(1,2)=Y1*5\4-J\2-K\4
2780 C(2,0)=Y2+K:C(2,1)=Y2+J:C(2,2)=Y2*5\4-J\2-K\4
2790 C(3,0)=Y3+K:C(3,1)=Y3+J:C(3,2)=Y3*5\4-J\2-K\4
2800 FOR L=0 TO 3
2810 FOR M=0 TO 2
2820 IF C(L,M)<0 THEN C(L,M)=0
2830 IF C(L,M)>31 THEN C(L,M)=31
2840 NEXT:NEXT
2850 POKE M_ADJ+I*4 ,C(0,0)*1024+C(0,1)*32+C(0,2),2
2860 POKE M_ADJ+I*4+2,C(1,0)*1024+C(1,1)*32+C(1,2),2
2870 POKE M_ADJ+I*4+4,C(2,0)*1024+C(2,1)*32+C(2,2),2
2880 POKE M_ADJ+I*4+6,C(3,0)*1024+C(3,1)*32+C(3,2),2
2890 NEXT
2900 PUT@A (0,H)-(255,H),GRPDAT
2910 NEXT:RETURN
2920 *GET_PAL '========================================================
2930 FOR J=0 TO 15
2940 PALDAT(J*3)=(ASC(MID$(S$,-(SCRMODE=3)*128+J*2+2)) AND 7)*32
2950 PALDAT(J*3+1)=(ASC(MID$(S$,-(SCRMODE=3)*128+J*2+1)) AND 112)*2
2960 PALDAT(J*3+2)=(ASC(MID$(S$,-(SCRMODE=3)*128+J*2+1)) AND 7)*32
2970 PALETTE J,[PALDAT(J*3),PALDAT(J*3+1),PALDAT(J*3+2)]
2980 NEXT
2990 P_SCH=1
3000 RETURN
3010 *ERR_TRAP1 '=======================================================
3020 PRINT "該当ファイルなし":BEEP:WAIT 80:RESUME *INIT
3030 *ERR_TRAP2 '=======================================================
3040 LOCATE 0,23
3050 IF ERR<>64 THEN PRINT "書き込み不可能";:BEEP:WAIT 120:ON ERROR GOTO 0: LOCATE 0,23:PRINT SPC(60);:RESUME *SAVE
3060 PRINT "同名のファイルが存在します。上書きしますか? ( Y/N ) : ";
3070 LOCATE 55,23:A$=INPUT$(1):PRINT A$;
3080 IF A$="N" OR A$="n" THEN 3100 ELSE IF A$<>"Y" AND A$<>"y" THEN 3070
3090 KILL SDR$+":"+LEFT$(NME$,INSTR(NME$,"."))+"TIF":RESUME
3100 LOCATE 0,23:PRINT SPC(60);:LOCATE 0,22
3110 INPUT"新しいファイルネームを入力してください : ";NME$
3111 IF NME$="" OR INSTR(NME$," ") THEN 3110
3120 NME$=NME$+".":LOCATE 0,22:PRINT SPC(60);:RESUME
3140 '= BOTTOM ==========================================================